home *** CD-ROM | disk | FTP | other *** search
- Path: EU.net!sun4nl!xs4all!usenet
- From: martijnl@xs4all.nl (Martijn Lievaart)
- Newsgroups: comp.lang.c++
- Subject: Re: Variable Problems
- Date: 7 Jan 1996 01:14:13 GMT
- Organization: XS4ALL, networking for the masses
- Message-ID: <4cn6p5$he7@news.xs4all.nl>
- References: <820864676snz@seacloud.demon.co.uk>
- NNTP-Posting-Host: mas01-09.dial.xs4all.nl
- X-Newsreader: WinVN 0.99.6
-
- In article <820864676snz@seacloud.demon.co.uk>, Ben@seacloud.demon.co.uk
- says...
- >
- >Hi,
- >
- >I am very new to C++, and for my first project I decided to develop and
- MS-DOS
- >game. A friend recommended MSVC, and so I purchased that. I have got the
- >hang of classes and such like, and the GUI for the game is going very well
- and
- >it even has mouse support.
- >
- >The only problem Im having, is that some variables seem to be getting over
- >written during execution, without me saying so. Using Codeview, I have
- >determined that this is happening after excessive class calls (ie, a line of
- >code is accessing several classes within classes many times). The variables
- >that are getting over written are members of the same parent class as the
- >classes which seem to be killing them. Judging by the new value of the
- >variable I don't want to be changed at that point, I think the value may be
- >coming from a member of the aforementioned class calls.
- >
- >I have checked the code throughly, and found, as I suspected, that I have
- only
- >set these variables once (in a constructor), and not again afterwards. I was
- >wondering if anybody out there knew why this was happening, and if there were
- >any more checks or a solution I could use to stop it happening.
- >
- >Sorry if its obvious. if anyone needs to look at the class definitions, I
- can
- >post (or Email) them.
- >
- >Hope somebody can help!
- >
- >--
- >Cheers,
- >
- >Ben
- >
-
- I wouldn't say this is obvious. When something like this occurs to me, it's
- time for tracepoints. You now, those breakpoints that break when a variable
- changes. Often difficult to get to work correctly, but beleave me, well worth
- the effort.
-
- I don't know VC, but I would think it supports tracepoints. BC even does them
- in hardware (386 and up support this in the processor!), makes them about 1000
- times faster. Without hardware support, your program slows to a crawl. Hmm,
- time for coffee.
-
- Hope this helps,
- Martijn
-
-